Integrand size = 38, antiderivative size = 175 \[ \int \frac {\cot (c+d x) \left (B \tan (c+d x)+C \tan ^2(c+d x)\right )}{(a+b \tan (c+d x))^3} \, dx=\frac {\left (a^3 B-3 a b^2 B+3 a^2 b C-b^3 C\right ) x}{\left (a^2+b^2\right )^3}+\frac {\left (3 a^2 b B-b^3 B-a^3 C+3 a b^2 C\right ) \log (a \cos (c+d x)+b \sin (c+d x))}{\left (a^2+b^2\right )^3 d}-\frac {b B-a C}{2 \left (a^2+b^2\right ) d (a+b \tan (c+d x))^2}-\frac {2 a b B-a^2 C+b^2 C}{\left (a^2+b^2\right )^2 d (a+b \tan (c+d x))} \]
(B*a^3-3*B*a*b^2+3*C*a^2*b-C*b^3)*x/(a^2+b^2)^3+(3*B*a^2*b-B*b^3-C*a^3+3*C *a*b^2)*ln(a*cos(d*x+c)+b*sin(d*x+c))/(a^2+b^2)^3/d+1/2*(-B*b+C*a)/(a^2+b^ 2)/d/(a+b*tan(d*x+c))^2+(-2*B*a*b+C*a^2-C*b^2)/(a^2+b^2)^2/d/(a+b*tan(d*x+ c))
Result contains complex when optimal does not.
Time = 4.74 (sec) , antiderivative size = 243, normalized size of antiderivative = 1.39 \[ \int \frac {\cot (c+d x) \left (B \tan (c+d x)+C \tan ^2(c+d x)\right )}{(a+b \tan (c+d x))^3} \, dx=-\frac {C \left (\frac {i \log (i-\tan (c+d x))}{(a+i b)^2}-\frac {i \log (i+\tan (c+d x))}{(a-i b)^2}+\frac {2 b \left (-2 a \log (a+b \tan (c+d x))+\frac {a^2+b^2}{a+b \tan (c+d x)}\right )}{\left (a^2+b^2\right )^2}\right )+(b B-a C) \left (\frac {i \log (i-\tan (c+d x))}{(a+i b)^3}-\frac {\log (i+\tan (c+d x))}{(i a+b)^3}+\frac {b \left (\left (-6 a^2+2 b^2\right ) \log (a+b \tan (c+d x))+\frac {\left (a^2+b^2\right ) \left (5 a^2+b^2+4 a b \tan (c+d x)\right )}{(a+b \tan (c+d x))^2}\right )}{\left (a^2+b^2\right )^3}\right )}{2 b d} \]
-1/2*(C*((I*Log[I - Tan[c + d*x]])/(a + I*b)^2 - (I*Log[I + Tan[c + d*x]]) /(a - I*b)^2 + (2*b*(-2*a*Log[a + b*Tan[c + d*x]] + (a^2 + b^2)/(a + b*Tan [c + d*x])))/(a^2 + b^2)^2) + (b*B - a*C)*((I*Log[I - Tan[c + d*x]])/(a + I*b)^3 - Log[I + Tan[c + d*x]]/(I*a + b)^3 + (b*((-6*a^2 + 2*b^2)*Log[a + b*Tan[c + d*x]] + ((a^2 + b^2)*(5*a^2 + b^2 + 4*a*b*Tan[c + d*x]))/(a + b* Tan[c + d*x])^2))/(a^2 + b^2)^3))/(b*d)
Time = 0.94 (sec) , antiderivative size = 197, normalized size of antiderivative = 1.13, number of steps used = 10, number of rules used = 10, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.263, Rules used = {3042, 4115, 3042, 4012, 3042, 4012, 3042, 4014, 3042, 4013}
Below are the steps used by Rubi to obtain the solution. The rule number used for the transformation is given above next to the arrow. The rules definitions used are listed below.
\(\displaystyle \int \frac {\cot (c+d x) \left (B \tan (c+d x)+C \tan ^2(c+d x)\right )}{(a+b \tan (c+d x))^3} \, dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {B \tan (c+d x)+C \tan (c+d x)^2}{\tan (c+d x) (a+b \tan (c+d x))^3}dx\) |
\(\Big \downarrow \) 4115 |
\(\displaystyle \int \frac {B+C \tan (c+d x)}{(a+b \tan (c+d x))^3}dx\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \int \frac {B+C \tan (c+d x)}{(a+b \tan (c+d x))^3}dx\) |
\(\Big \downarrow \) 4012 |
\(\displaystyle \frac {\int \frac {a B+b C-(b B-a C) \tan (c+d x)}{(a+b \tan (c+d x))^2}dx}{a^2+b^2}-\frac {b B-a C}{2 d \left (a^2+b^2\right ) (a+b \tan (c+d x))^2}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {\int \frac {a B+b C-(b B-a C) \tan (c+d x)}{(a+b \tan (c+d x))^2}dx}{a^2+b^2}-\frac {b B-a C}{2 d \left (a^2+b^2\right ) (a+b \tan (c+d x))^2}\) |
\(\Big \downarrow \) 4012 |
\(\displaystyle \frac {\frac {\int \frac {B a^2+2 b C a-b^2 B-\left (-C a^2+2 b B a+b^2 C\right ) \tan (c+d x)}{a+b \tan (c+d x)}dx}{a^2+b^2}-\frac {a^2 (-C)+2 a b B+b^2 C}{d \left (a^2+b^2\right ) (a+b \tan (c+d x))}}{a^2+b^2}-\frac {b B-a C}{2 d \left (a^2+b^2\right ) (a+b \tan (c+d x))^2}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {\frac {\int \frac {B a^2+2 b C a-b^2 B-\left (-C a^2+2 b B a+b^2 C\right ) \tan (c+d x)}{a+b \tan (c+d x)}dx}{a^2+b^2}-\frac {a^2 (-C)+2 a b B+b^2 C}{d \left (a^2+b^2\right ) (a+b \tan (c+d x))}}{a^2+b^2}-\frac {b B-a C}{2 d \left (a^2+b^2\right ) (a+b \tan (c+d x))^2}\) |
\(\Big \downarrow \) 4014 |
\(\displaystyle \frac {\frac {\frac {\left (a^3 (-C)+3 a^2 b B+3 a b^2 C-b^3 B\right ) \int \frac {b-a \tan (c+d x)}{a+b \tan (c+d x)}dx}{a^2+b^2}+\frac {x \left (a^3 B+3 a^2 b C-3 a b^2 B-b^3 C\right )}{a^2+b^2}}{a^2+b^2}-\frac {a^2 (-C)+2 a b B+b^2 C}{d \left (a^2+b^2\right ) (a+b \tan (c+d x))}}{a^2+b^2}-\frac {b B-a C}{2 d \left (a^2+b^2\right ) (a+b \tan (c+d x))^2}\) |
\(\Big \downarrow \) 3042 |
\(\displaystyle \frac {\frac {\frac {\left (a^3 (-C)+3 a^2 b B+3 a b^2 C-b^3 B\right ) \int \frac {b-a \tan (c+d x)}{a+b \tan (c+d x)}dx}{a^2+b^2}+\frac {x \left (a^3 B+3 a^2 b C-3 a b^2 B-b^3 C\right )}{a^2+b^2}}{a^2+b^2}-\frac {a^2 (-C)+2 a b B+b^2 C}{d \left (a^2+b^2\right ) (a+b \tan (c+d x))}}{a^2+b^2}-\frac {b B-a C}{2 d \left (a^2+b^2\right ) (a+b \tan (c+d x))^2}\) |
\(\Big \downarrow \) 4013 |
\(\displaystyle \frac {\frac {\frac {\left (a^3 (-C)+3 a^2 b B+3 a b^2 C-b^3 B\right ) \log (a \cos (c+d x)+b \sin (c+d x))}{d \left (a^2+b^2\right )}+\frac {x \left (a^3 B+3 a^2 b C-3 a b^2 B-b^3 C\right )}{a^2+b^2}}{a^2+b^2}-\frac {a^2 (-C)+2 a b B+b^2 C}{d \left (a^2+b^2\right ) (a+b \tan (c+d x))}}{a^2+b^2}-\frac {b B-a C}{2 d \left (a^2+b^2\right ) (a+b \tan (c+d x))^2}\) |
-1/2*(b*B - a*C)/((a^2 + b^2)*d*(a + b*Tan[c + d*x])^2) + ((((a^3*B - 3*a* b^2*B + 3*a^2*b*C - b^3*C)*x)/(a^2 + b^2) + ((3*a^2*b*B - b^3*B - a^3*C + 3*a*b^2*C)*Log[a*Cos[c + d*x] + b*Sin[c + d*x]])/((a^2 + b^2)*d))/(a^2 + b ^2) - (2*a*b*B - a^2*C + b^2*C)/((a^2 + b^2)*d*(a + b*Tan[c + d*x])))/(a^2 + b^2)
3.1.42.3.1 Defintions of rubi rules used
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)]), x_Symbol] :> Simp[(b*c - a*d)*((a + b*Tan[e + f*x])^(m + 1)/ (f*(m + 1)*(a^2 + b^2))), x] + Simp[1/(a^2 + b^2) Int[(a + b*Tan[e + f*x] )^(m + 1)*Simp[a*c + b*d - (b*c - a*d)*Tan[e + f*x], x], x], x] /; FreeQ[{a , b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && LtQ[m, -1 ]
Int[((c_) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_) + (b_.)*tan[(e_.) + (f_.)* (x_)]), x_Symbol] :> Simp[(c/(b*f))*Log[RemoveContent[a*Cos[e + f*x] + b*Si n[e + f*x], x]], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && EqQ[a*c + b*d, 0]
Int[((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])/((a_.) + (b_.)*tan[(e_.) + (f_. )*(x_)]), x_Symbol] :> Simp[(a*c + b*d)*(x/(a^2 + b^2)), x] + Simp[(b*c - a *d)/(a^2 + b^2) Int[(b - a*Tan[e + f*x])/(a + b*Tan[e + f*x]), x], x] /; FreeQ[{a, b, c, d, e, f}, x] && NeQ[b*c - a*d, 0] && NeQ[a^2 + b^2, 0] && N eQ[a*c + b*d, 0]
Int[((a_.) + (b_.)*tan[(e_.) + (f_.)*(x_)])^(m_.)*((c_.) + (d_.)*tan[(e_.) + (f_.)*(x_)])^(n_.)*((A_.) + (B_.)*tan[(e_.) + (f_.)*(x_)] + (C_.)*tan[(e_ .) + (f_.)*(x_)]^2), x_Symbol] :> Simp[1/b^2 Int[(a + b*Tan[e + f*x])^(m + 1)*(c + d*Tan[e + f*x])^n*(b*B - a*C + b*C*Tan[e + f*x]), x], x] /; FreeQ [{a, b, c, d, e, f, A, B, C, m, n}, x] && NeQ[b*c - a*d, 0] && EqQ[A*b^2 - a*b*B + a^2*C, 0]
Time = 0.50 (sec) , antiderivative size = 208, normalized size of antiderivative = 1.19
method | result | size |
derivativedivides | \(\frac {\frac {\frac {\left (-3 B \,a^{2} b +B \,b^{3}+C \,a^{3}-3 C a \,b^{2}\right ) \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2}+\left (B \,a^{3}-3 B a \,b^{2}+3 C \,a^{2} b -C \,b^{3}\right ) \arctan \left (\tan \left (d x +c \right )\right )}{\left (a^{2}+b^{2}\right )^{3}}+\frac {\left (3 B \,a^{2} b -B \,b^{3}-C \,a^{3}+3 C a \,b^{2}\right ) \ln \left (a +b \tan \left (d x +c \right )\right )}{\left (a^{2}+b^{2}\right )^{3}}-\frac {B b -C a}{2 \left (a^{2}+b^{2}\right ) \left (a +b \tan \left (d x +c \right )\right )^{2}}-\frac {2 B a b -C \,a^{2}+C \,b^{2}}{\left (a^{2}+b^{2}\right )^{2} \left (a +b \tan \left (d x +c \right )\right )}}{d}\) | \(208\) |
default | \(\frac {\frac {\frac {\left (-3 B \,a^{2} b +B \,b^{3}+C \,a^{3}-3 C a \,b^{2}\right ) \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2}+\left (B \,a^{3}-3 B a \,b^{2}+3 C \,a^{2} b -C \,b^{3}\right ) \arctan \left (\tan \left (d x +c \right )\right )}{\left (a^{2}+b^{2}\right )^{3}}+\frac {\left (3 B \,a^{2} b -B \,b^{3}-C \,a^{3}+3 C a \,b^{2}\right ) \ln \left (a +b \tan \left (d x +c \right )\right )}{\left (a^{2}+b^{2}\right )^{3}}-\frac {B b -C a}{2 \left (a^{2}+b^{2}\right ) \left (a +b \tan \left (d x +c \right )\right )^{2}}-\frac {2 B a b -C \,a^{2}+C \,b^{2}}{\left (a^{2}+b^{2}\right )^{2} \left (a +b \tan \left (d x +c \right )\right )}}{d}\) | \(208\) |
parallelrisch | \(\frac {6 a \left (B \,a^{2} b -\frac {1}{3} B \,b^{3}-\frac {1}{3} C \,a^{3}+C a \,b^{2}\right ) \left (a +b \tan \left (d x +c \right )\right )^{2} \ln \left (a +b \tan \left (d x +c \right )\right )-3 a \left (B \,a^{2} b -\frac {1}{3} B \,b^{3}-\frac {1}{3} C \,a^{3}+C a \,b^{2}\right ) \left (a +b \tan \left (d x +c \right )\right )^{2} \ln \left (\sec \left (d x +c \right )^{2}\right )+2 b^{2} \left (\left (B d x -\frac {C}{2}\right ) a^{4}+b \left (3 C d x +B \right ) a^{3}-3 B x \,a^{2} b^{2} d +b^{3} \left (-C d x +B \right ) a +\frac {C \,b^{4}}{2}\right ) \tan \left (d x +c \right )^{2}+4 a^{2} b d x \left (B \,a^{3}-3 B a \,b^{2}+3 C \,a^{2} b -C \,b^{3}\right ) \tan \left (d x +c \right )+2 a \left (\left (B d x +C \right ) a^{5}-\frac {3 a^{4} \left (-2 C d x +B \right ) b}{2}-3 b^{2} \left (B d x -\frac {C}{3}\right ) a^{3}-2 b^{3} \left (\frac {C d x}{2}+B \right ) a^{2}-\frac {B \,b^{5}}{2}\right )}{2 \left (a^{2}+b^{2}\right )^{3} a d \left (a +b \tan \left (d x +c \right )\right )^{2}}\) | \(302\) |
norman | \(\frac {\frac {\left (B \,a^{3}-3 B a \,b^{2}+3 C \,a^{2} b -C \,b^{3}\right ) a^{2} x}{\left (a^{4}+2 a^{2} b^{2}+b^{4}\right ) \left (a^{2}+b^{2}\right )}+\frac {b^{2} \left (B \,a^{3}-3 B a \,b^{2}+3 C \,a^{2} b -C \,b^{3}\right ) x \tan \left (d x +c \right )^{2}}{\left (a^{4}+2 a^{2} b^{2}+b^{4}\right ) \left (a^{2}+b^{2}\right )}-\frac {3 B \,a^{2} b^{2}+B \,b^{4}-2 C \,a^{3} b}{2 b d \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}+\frac {b \left (2 B a \,b^{2}-C \,a^{2} b +C \,b^{3}\right ) \tan \left (d x +c \right )^{2}}{2 d a \left (a^{4}+2 a^{2} b^{2}+b^{4}\right )}+\frac {2 b \left (B \,a^{3}-3 B a \,b^{2}+3 C \,a^{2} b -C \,b^{3}\right ) a x \tan \left (d x +c \right )}{\left (a^{4}+2 a^{2} b^{2}+b^{4}\right ) \left (a^{2}+b^{2}\right )}}{\left (a +b \tan \left (d x +c \right )\right )^{2}}+\frac {\left (3 B \,a^{2} b -B \,b^{3}-C \,a^{3}+3 C a \,b^{2}\right ) \ln \left (a +b \tan \left (d x +c \right )\right )}{d \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}-\frac {\left (3 B \,a^{2} b -B \,b^{3}-C \,a^{3}+3 C a \,b^{2}\right ) \ln \left (1+\tan \left (d x +c \right )^{2}\right )}{2 d \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}\) | \(437\) |
risch | \(-\frac {x B}{3 i a^{2} b -i b^{3}-a^{3}+3 a \,b^{2}}+\frac {i x C}{3 i a^{2} b -i b^{3}-a^{3}+3 a \,b^{2}}-\frac {6 i B \,a^{2} b x}{a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}}+\frac {2 i B \,b^{3} x}{a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}}+\frac {2 i C \,a^{3} x}{a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}}-\frac {6 i C a \,b^{2} x}{a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}}-\frac {6 i B \,a^{2} b c}{d \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}+\frac {2 i B \,b^{3} c}{d \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}+\frac {2 i C \,a^{3} c}{d \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}-\frac {6 i C a \,b^{2} c}{d \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}+\frac {2 b \left (-2 i B a \,b^{2} {\mathrm e}^{2 i \left (d x +c \right )}+i C \,a^{2} b \,{\mathrm e}^{2 i \left (d x +c \right )}-i C \,b^{3} {\mathrm e}^{2 i \left (d x +c \right )}+3 B \,a^{2} b \,{\mathrm e}^{2 i \left (d x +c \right )}+B \,b^{3} {\mathrm e}^{2 i \left (d x +c \right )}-2 C \,a^{3} {\mathrm e}^{2 i \left (d x +c \right )}+3 i B a \,b^{2}-2 i C \,a^{2} b +i C \,b^{3}+3 B \,a^{2} b -2 C \,a^{3}+C a \,b^{2}\right )}{\left (b \,{\mathrm e}^{2 i \left (d x +c \right )}+i a \,{\mathrm e}^{2 i \left (d x +c \right )}-b +i a \right )^{2} \left (-i a +b \right )^{2} d \left (i a +b \right )^{3}}+\frac {3 a^{2} b \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {i b +a}{i b -a}\right ) B}{d \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}-\frac {\ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {i b +a}{i b -a}\right ) B \,b^{3}}{d \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}-\frac {a^{3} \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {i b +a}{i b -a}\right ) C}{d \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}+\frac {3 \ln \left ({\mathrm e}^{2 i \left (d x +c \right )}-\frac {i b +a}{i b -a}\right ) C a \,b^{2}}{d \left (a^{6}+3 a^{4} b^{2}+3 a^{2} b^{4}+b^{6}\right )}\) | \(793\) |
1/d*(1/(a^2+b^2)^3*(1/2*(-3*B*a^2*b+B*b^3+C*a^3-3*C*a*b^2)*ln(1+tan(d*x+c) ^2)+(B*a^3-3*B*a*b^2+3*C*a^2*b-C*b^3)*arctan(tan(d*x+c)))+(3*B*a^2*b-B*b^3 -C*a^3+3*C*a*b^2)/(a^2+b^2)^3*ln(a+b*tan(d*x+c))-1/2*(B*b-C*a)/(a^2+b^2)/( a+b*tan(d*x+c))^2-(2*B*a*b-C*a^2+C*b^2)/(a^2+b^2)^2/(a+b*tan(d*x+c)))
Leaf count of result is larger than twice the leaf count of optimal. 482 vs. \(2 (171) = 342\).
Time = 0.28 (sec) , antiderivative size = 482, normalized size of antiderivative = 2.75 \[ \int \frac {\cot (c+d x) \left (B \tan (c+d x)+C \tan ^2(c+d x)\right )}{(a+b \tan (c+d x))^3} \, dx=\frac {5 \, C a^{3} b^{2} - 7 \, B a^{2} b^{3} - C a b^{4} - B b^{5} + 2 \, {\left (B a^{5} + 3 \, C a^{4} b - 3 \, B a^{3} b^{2} - C a^{2} b^{3}\right )} d x - {\left (3 \, C a^{3} b^{2} - 5 \, B a^{2} b^{3} - 3 \, C a b^{4} + B b^{5} - 2 \, {\left (B a^{3} b^{2} + 3 \, C a^{2} b^{3} - 3 \, B a b^{4} - C b^{5}\right )} d x\right )} \tan \left (d x + c\right )^{2} - {\left (C a^{5} - 3 \, B a^{4} b - 3 \, C a^{3} b^{2} + B a^{2} b^{3} + {\left (C a^{3} b^{2} - 3 \, B a^{2} b^{3} - 3 \, C a b^{4} + B b^{5}\right )} \tan \left (d x + c\right )^{2} + 2 \, {\left (C a^{4} b - 3 \, B a^{3} b^{2} - 3 \, C a^{2} b^{3} + B a b^{4}\right )} \tan \left (d x + c\right )\right )} \log \left (\frac {b^{2} \tan \left (d x + c\right )^{2} + 2 \, a b \tan \left (d x + c\right ) + a^{2}}{\tan \left (d x + c\right )^{2} + 1}\right ) - 2 \, {\left (2 \, C a^{4} b - 3 \, B a^{3} b^{2} - 3 \, C a^{2} b^{3} + 3 \, B a b^{4} + C b^{5} - 2 \, {\left (B a^{4} b + 3 \, C a^{3} b^{2} - 3 \, B a^{2} b^{3} - C a b^{4}\right )} d x\right )} \tan \left (d x + c\right )}{2 \, {\left ({\left (a^{6} b^{2} + 3 \, a^{4} b^{4} + 3 \, a^{2} b^{6} + b^{8}\right )} d \tan \left (d x + c\right )^{2} + 2 \, {\left (a^{7} b + 3 \, a^{5} b^{3} + 3 \, a^{3} b^{5} + a b^{7}\right )} d \tan \left (d x + c\right ) + {\left (a^{8} + 3 \, a^{6} b^{2} + 3 \, a^{4} b^{4} + a^{2} b^{6}\right )} d\right )}} \]
1/2*(5*C*a^3*b^2 - 7*B*a^2*b^3 - C*a*b^4 - B*b^5 + 2*(B*a^5 + 3*C*a^4*b - 3*B*a^3*b^2 - C*a^2*b^3)*d*x - (3*C*a^3*b^2 - 5*B*a^2*b^3 - 3*C*a*b^4 + B* b^5 - 2*(B*a^3*b^2 + 3*C*a^2*b^3 - 3*B*a*b^4 - C*b^5)*d*x)*tan(d*x + c)^2 - (C*a^5 - 3*B*a^4*b - 3*C*a^3*b^2 + B*a^2*b^3 + (C*a^3*b^2 - 3*B*a^2*b^3 - 3*C*a*b^4 + B*b^5)*tan(d*x + c)^2 + 2*(C*a^4*b - 3*B*a^3*b^2 - 3*C*a^2*b ^3 + B*a*b^4)*tan(d*x + c))*log((b^2*tan(d*x + c)^2 + 2*a*b*tan(d*x + c) + a^2)/(tan(d*x + c)^2 + 1)) - 2*(2*C*a^4*b - 3*B*a^3*b^2 - 3*C*a^2*b^3 + 3 *B*a*b^4 + C*b^5 - 2*(B*a^4*b + 3*C*a^3*b^2 - 3*B*a^2*b^3 - C*a*b^4)*d*x)* tan(d*x + c))/((a^6*b^2 + 3*a^4*b^4 + 3*a^2*b^6 + b^8)*d*tan(d*x + c)^2 + 2*(a^7*b + 3*a^5*b^3 + 3*a^3*b^5 + a*b^7)*d*tan(d*x + c) + (a^8 + 3*a^6*b^ 2 + 3*a^4*b^4 + a^2*b^6)*d)
Exception generated. \[ \int \frac {\cot (c+d x) \left (B \tan (c+d x)+C \tan ^2(c+d x)\right )}{(a+b \tan (c+d x))^3} \, dx=\text {Exception raised: AttributeError} \]
Time = 0.32 (sec) , antiderivative size = 321, normalized size of antiderivative = 1.83 \[ \int \frac {\cot (c+d x) \left (B \tan (c+d x)+C \tan ^2(c+d x)\right )}{(a+b \tan (c+d x))^3} \, dx=\frac {\frac {2 \, {\left (B a^{3} + 3 \, C a^{2} b - 3 \, B a b^{2} - C b^{3}\right )} {\left (d x + c\right )}}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} - \frac {2 \, {\left (C a^{3} - 3 \, B a^{2} b - 3 \, C a b^{2} + B b^{3}\right )} \log \left (b \tan \left (d x + c\right ) + a\right )}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} + \frac {{\left (C a^{3} - 3 \, B a^{2} b - 3 \, C a b^{2} + B b^{3}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} + \frac {3 \, C a^{3} - 5 \, B a^{2} b - C a b^{2} - B b^{3} + 2 \, {\left (C a^{2} b - 2 \, B a b^{2} - C b^{3}\right )} \tan \left (d x + c\right )}{a^{6} + 2 \, a^{4} b^{2} + a^{2} b^{4} + {\left (a^{4} b^{2} + 2 \, a^{2} b^{4} + b^{6}\right )} \tan \left (d x + c\right )^{2} + 2 \, {\left (a^{5} b + 2 \, a^{3} b^{3} + a b^{5}\right )} \tan \left (d x + c\right )}}{2 \, d} \]
1/2*(2*(B*a^3 + 3*C*a^2*b - 3*B*a*b^2 - C*b^3)*(d*x + c)/(a^6 + 3*a^4*b^2 + 3*a^2*b^4 + b^6) - 2*(C*a^3 - 3*B*a^2*b - 3*C*a*b^2 + B*b^3)*log(b*tan(d *x + c) + a)/(a^6 + 3*a^4*b^2 + 3*a^2*b^4 + b^6) + (C*a^3 - 3*B*a^2*b - 3* C*a*b^2 + B*b^3)*log(tan(d*x + c)^2 + 1)/(a^6 + 3*a^4*b^2 + 3*a^2*b^4 + b^ 6) + (3*C*a^3 - 5*B*a^2*b - C*a*b^2 - B*b^3 + 2*(C*a^2*b - 2*B*a*b^2 - C*b ^3)*tan(d*x + c))/(a^6 + 2*a^4*b^2 + a^2*b^4 + (a^4*b^2 + 2*a^2*b^4 + b^6) *tan(d*x + c)^2 + 2*(a^5*b + 2*a^3*b^3 + a*b^5)*tan(d*x + c)))/d
Leaf count of result is larger than twice the leaf count of optimal. 409 vs. \(2 (171) = 342\).
Time = 1.25 (sec) , antiderivative size = 409, normalized size of antiderivative = 2.34 \[ \int \frac {\cot (c+d x) \left (B \tan (c+d x)+C \tan ^2(c+d x)\right )}{(a+b \tan (c+d x))^3} \, dx=\frac {\frac {2 \, {\left (B a^{3} + 3 \, C a^{2} b - 3 \, B a b^{2} - C b^{3}\right )} {\left (d x + c\right )}}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} + \frac {{\left (C a^{3} - 3 \, B a^{2} b - 3 \, C a b^{2} + B b^{3}\right )} \log \left (\tan \left (d x + c\right )^{2} + 1\right )}{a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}} - \frac {2 \, {\left (C a^{3} b - 3 \, B a^{2} b^{2} - 3 \, C a b^{3} + B b^{4}\right )} \log \left ({\left | b \tan \left (d x + c\right ) + a \right |}\right )}{a^{6} b + 3 \, a^{4} b^{3} + 3 \, a^{2} b^{5} + b^{7}} + \frac {3 \, C a^{3} b^{2} \tan \left (d x + c\right )^{2} - 9 \, B a^{2} b^{3} \tan \left (d x + c\right )^{2} - 9 \, C a b^{4} \tan \left (d x + c\right )^{2} + 3 \, B b^{5} \tan \left (d x + c\right )^{2} + 8 \, C a^{4} b \tan \left (d x + c\right ) - 22 \, B a^{3} b^{2} \tan \left (d x + c\right ) - 18 \, C a^{2} b^{3} \tan \left (d x + c\right ) + 2 \, B a b^{4} \tan \left (d x + c\right ) - 2 \, C b^{5} \tan \left (d x + c\right ) + 6 \, C a^{5} - 14 \, B a^{4} b - 7 \, C a^{3} b^{2} - 3 \, B a^{2} b^{3} - C a b^{4} - B b^{5}}{{\left (a^{6} + 3 \, a^{4} b^{2} + 3 \, a^{2} b^{4} + b^{6}\right )} {\left (b \tan \left (d x + c\right ) + a\right )}^{2}}}{2 \, d} \]
1/2*(2*(B*a^3 + 3*C*a^2*b - 3*B*a*b^2 - C*b^3)*(d*x + c)/(a^6 + 3*a^4*b^2 + 3*a^2*b^4 + b^6) + (C*a^3 - 3*B*a^2*b - 3*C*a*b^2 + B*b^3)*log(tan(d*x + c)^2 + 1)/(a^6 + 3*a^4*b^2 + 3*a^2*b^4 + b^6) - 2*(C*a^3*b - 3*B*a^2*b^2 - 3*C*a*b^3 + B*b^4)*log(abs(b*tan(d*x + c) + a))/(a^6*b + 3*a^4*b^3 + 3*a ^2*b^5 + b^7) + (3*C*a^3*b^2*tan(d*x + c)^2 - 9*B*a^2*b^3*tan(d*x + c)^2 - 9*C*a*b^4*tan(d*x + c)^2 + 3*B*b^5*tan(d*x + c)^2 + 8*C*a^4*b*tan(d*x + c ) - 22*B*a^3*b^2*tan(d*x + c) - 18*C*a^2*b^3*tan(d*x + c) + 2*B*a*b^4*tan( d*x + c) - 2*C*b^5*tan(d*x + c) + 6*C*a^5 - 14*B*a^4*b - 7*C*a^3*b^2 - 3*B *a^2*b^3 - C*a*b^4 - B*b^5)/((a^6 + 3*a^4*b^2 + 3*a^2*b^4 + b^6)*(b*tan(d* x + c) + a)^2))/d
Time = 8.56 (sec) , antiderivative size = 279, normalized size of antiderivative = 1.59 \[ \int \frac {\cot (c+d x) \left (B \tan (c+d x)+C \tan ^2(c+d x)\right )}{(a+b \tan (c+d x))^3} \, dx=\frac {\ln \left (a+b\,\mathrm {tan}\left (c+d\,x\right )\right )\,\left (\frac {3\,B\,b-C\,a}{{\left (a^2+b^2\right )}^2}-\frac {4\,b^2\,\left (B\,b-C\,a\right )}{{\left (a^2+b^2\right )}^3}\right )}{d}-\frac {\frac {-3\,C\,a^3+5\,B\,a^2\,b+C\,a\,b^2+B\,b^3}{2\,\left (a^4+2\,a^2\,b^2+b^4\right )}+\frac {\mathrm {tan}\left (c+d\,x\right )\,\left (-C\,a^2\,b+2\,B\,a\,b^2+C\,b^3\right )}{a^4+2\,a^2\,b^2+b^4}}{d\,\left (a^2+2\,a\,b\,\mathrm {tan}\left (c+d\,x\right )+b^2\,{\mathrm {tan}\left (c+d\,x\right )}^2\right )}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )-\mathrm {i}\right )\,\left (-C+B\,1{}\mathrm {i}\right )}{2\,d\,\left (-a^3-a^2\,b\,3{}\mathrm {i}+3\,a\,b^2+b^3\,1{}\mathrm {i}\right )}+\frac {\ln \left (\mathrm {tan}\left (c+d\,x\right )+1{}\mathrm {i}\right )\,\left (B-C\,1{}\mathrm {i}\right )}{2\,d\,\left (-a^3\,1{}\mathrm {i}-3\,a^2\,b+a\,b^2\,3{}\mathrm {i}+b^3\right )} \]
(log(a + b*tan(c + d*x))*((3*B*b - C*a)/(a^2 + b^2)^2 - (4*b^2*(B*b - C*a) )/(a^2 + b^2)^3))/d - ((B*b^3 - 3*C*a^3 + 5*B*a^2*b + C*a*b^2)/(2*(a^4 + b ^4 + 2*a^2*b^2)) + (tan(c + d*x)*(C*b^3 + 2*B*a*b^2 - C*a^2*b))/(a^4 + b^4 + 2*a^2*b^2))/(d*(a^2 + b^2*tan(c + d*x)^2 + 2*a*b*tan(c + d*x))) + (log( tan(c + d*x) - 1i)*(B*1i - C))/(2*d*(3*a*b^2 - a^2*b*3i - a^3 + b^3*1i)) + (log(tan(c + d*x) + 1i)*(B - C*1i))/(2*d*(a*b^2*3i - 3*a^2*b - a^3*1i + b ^3))